<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\AdminController;
use App\User;

class UserController extends AdminController
{
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('themeView::user.index');
    }

    /**
     * 获取会员列表
     */
    public function getList(Request $request)
    {
        $output = $this->output->init("user/getList", "获取会员列表成功");
        $name = $request->name;
        if ($name) {
            $userList = User::where('name', $name)->paginate(2);
        } else {
            $userList = User::paginate(2);
        }

        $output->setData($userList);
        return $output->json();
    }
}
